Skip to content

Conversation

@ironAiken2
Copy link
Contributor

@ironAiken2 ironAiken2 commented Oct 20, 2025

Resolves #4316 (FR-1501)

Changes

Fixes file upload status tracking and progress calculation issues, particularly for concurrent uploads. Refactored the upload state management to properly track upload progress using bytes instead of just file counts.

Key Changes

  1. Enhanced State Management Structure

  2. Fixed Progress Calculation

  • Problem: Progress was only tracked by file count, not actual bytes uploaded
  • Solution:
    • Added completedBytes to track actual upload progress
    • Added totalExpectedSize for accurate percentage calculation
    • Progress now shows: completedBytes / totalExpectedSize * 100
  1. Fixed Cumulative Bytes Issue
  • Problem: onProgress callback provides cumulative bytesUploaded, not incremental
  • Solution: Calculate delta bytes for each progress update
  let previousBytesUploaded = 0;
  const deltaBytes = bytesUploaded - previousBytesUploaded;
  previousBytesUploaded = bytesUploaded;
  1. Improved Concurrent Upload Handling
  • Problem: When starting new uploads while others are in progress, total size wasn't properly accumulated
  • Solution:
    • totalExpectedSize accumulates across all upload requests
    • All progress callbacks reference the same total from state
    • Proper reset when all uploads complete
  1. Better Upload Status Notifications
  • Progress notifications now show both file count and byte-based percentage
  • More accurate progress tracking during uploads
  • Proper cleanup of state after completion

Testing

  • Single file upload progress tracking
  • Multiple files upload (folder) progress tracking
  • Concurrent uploads (starting new upload while another
    is in progress)
  • Upload failure handling
  • Progress percentage accuracy

Technical Details

The main issue was that the original implementation only tracked file names without considering actual bytes uploaded. This led to inaccurate progress reporting, especially for files of varying sizes. The new implementation:

  1. Tracks both file counts and bytes for comprehensive progress reporting
  2. Properly handles cumulative vs incremental byte reporting from the TUS upload library
  3. Maintains a single source of truth (totalExpectedSize) for all concurrent uploads
  4. Correctly accumulates sizes when new uploads are added

Checklist:

  • Documentation
  • Minimum required manager version
  • Specific setting for review
  • Minimum requirements to check during review
  • Test case: Upload multiple files and verify status tracking works correctly

@github-actions github-actions bot added the size:L 100~500 LoC label Oct 20, 2025
Copy link
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ironAiken2 ironAiken2 marked this pull request as ready for review October 20, 2025 05:12
Copilot AI review requested due to automatic review settings October 20, 2025 05:12
@github-actions
Copy link

github-actions bot commented Oct 20, 2025

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
4.65% (-0.01% 🔻)
532/11445
🔴 Branches
3.75% (-0.01% 🔻)
302/8056
🔴 Functions
2.88% (-0% 🔻)
102/3547
🔴 Lines
4.6% (-0.01% 🔻)
514/11186

Test suite run success

121 tests passing in 14 suites.

Report generated by 🧪jest coverage report action from 8a3b9bd

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes inaccurate and fragile file upload status tracking by restructuring status data and improving progress calculation and notifications.

  • Introduces structured UploadStatus objects with vFolderNames and totalSize.
  • Adds byte-based progress and concurrent uploads (PQueue concurrency 10).
  • Adjusts FolderExplorer to new status shape.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
react/src/components/FolderExplorer.tsx Updated empty-pending check to match new nested status structure.
react/src/components/FileUploadManager.tsx Refactored data structures, progress computation, notification messaging, and concurrency.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ironAiken2 ironAiken2 force-pushed the fix/FR-1501-file-upload-status-tracking branch from d5cfaff to 3f7e879 Compare October 20, 2025 07:23
Copy link
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please apply copilot's reviews and resolve conflicts

@ironAiken2 ironAiken2 force-pushed the fix/FR-1501-file-upload-status-tracking branch 3 times, most recently from bbb4912 to c4f7e84 Compare October 27, 2025 06:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ironAiken2 ironAiken2 force-pushed the fix/FR-1501-file-upload-status-tracking branch from c4f7e84 to 8a3b9bd Compare October 27, 2025 06:44
@ironAiken2 ironAiken2 marked this pull request as draft October 27, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance the file upload logic to support multi-file uploads in the upload queue, and update the notification display accordingly

2 participants